<template>
  <div class="layout-aside-container">
    <!-- 左侧边栏列表 -->
    <ul class="user-select-none menu">
      <li class="menu-item image" >
    <img src="../../assets/image/student.jpeg" >
     <div class="info" ref="info">
          <p>姓名:{{name}}</p>
          <p>性别:{{sex}}</p>
          <p>班级:{{banji}}</p>
      </div>
      </li>
      <li class="menu-item">
        <router-link to="/stuhome/testdisplay">做测试</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/stuhome/resultqury">测试结果</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/stuhome/modpsw">修改密码</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/start/login">退出登录</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
import {request} from '../../api/index'
export default {
    //侧边栏菜单
    name:'Aside',
    props:{

    },
    data(){
        return {
            name:"",
            sex:"",
            banji:""
        }
    },
    created() {
      this.initData()
    },
    methods: {
        initData(){
          request({method:'post',url:'/user/person_information',
                  data:{id:this.$store.state.login_id}}).then((res)=>{
                    if(res.data.message=='success'){
                      this.name=res.data.name
                      this.sex=res.data.sex=='0'?'男':'女'
                      this.banji=res.data.class.class_name
                    }
                  }).catch((err)=>{console.log(err)})

        }
        
    },

}
</script>

<style lang="less" scoped>
.layout-aside-container {
  width: 250px;
  height: 100%;
  border-right: 1px solid #eaeaea;
}

.menu {
  list-style-type: none;
  padding: 0;
  .menu-item {
    text-align: center;
    line-height: 50px;
    font-weight: bold;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
      'Helvetica Neue', sans-serif;
    &:hover {
      background-color: #efefef;
      cursor: pointer;
    }
    a {
      display: block;
      color: black;
      padding-left: 30px;
      font-size: 19px;
      &:hover {
        text-decoration: none;
      }
    }
  }
}

// 设置路由高亮效果
.router-link-active {
  background-color: #efefef;
  box-sizing: border-box;
  position: relative;
  // 伪元素实现路由高亮效果
  &::before {
    content: ' ';
    display: block;
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background-color: #071ff7;
  }
}
.image{
    position: relative;
    text-align: center;
    height: 250px;
    img{
      width:100%;
      height:100%;
    }
}
.image:hover .info{
  display: block;
}

.info{
    position: absolute;
    height: 100px;
    width: 200px;
    border-radius: 100% 100% 100% 0;
    background-color: rgb(161, 199, 241);
    border: 2px solid rgb(161, 199, 241);
    right:-90px;
    top:-10px;
    padding: 15px;
    padding-left:25px;
    display: none;
}
p{
    margin-left:0;
    padding:0;
    height: 3px;
}


</style>